<?php
// $Id: create_config.php 229 2008-03-03 13:27:42Z mikhail.miguel $

// 2006-09-20 K.OHWADA
// use happy_linux
// remove class admin_config_file
// use bin_pass

// 2006-05-15 K.OHWADA
// use admin_config_file

//================================================================
// WebLinks Module
// create config file for bin/link_check.php
// 2004-10-20 K.OHWADA
//================================================================
include 'admin_header.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/config_file.php';

$conf_handler =& weblinks_get_handler('config2_basic', WEBLINKS_DIRNAME);
$config_file  =& happy_linux_config_file::getInstance();

$DIR_CONFIG  = WEBLINKS_ROOT_PATH."/cache";
$FILE_CONFIG = $DIR_CONFIG."/config.php";

xoops_cp_header();

$conf =& $conf_handler->get_conf();
$pass = $conf['bin_pass'];
$url_link_check = '../bin/link_check.php?pass='.$pass.'&amp;limit=10';

//weblinks_admin_print_header();
//weblinks_admin_print_menu();

weblinks_admin_print_bread( _AM_WEBLINKS_COMMAND_MANAGE, 'command_manage.php', _AM_WEBLINKS_CREATE_CONFIG );
echo "<h3>"._AM_WEBLINKS_CREATE_CONFIG."</h3>\n";
echo "Create config file for bin/link_check.php <br /><br />\n";

if ( is_writable( $DIR_CONFIG ) ) 
{
	$config_file->_save_config( $FILE_CONFIG );

	echo "<hr />\n";
	echo "<h4>"._CREATED."</h4>\n";
	echo '<a href="'.$url_link_check.'">'.sprintf(_AM_WEBLINKS_TEST_EXEC, 'bin/link_check.php')."</a></li>\n";

}
else
{
	echo "<h3 style='color: #ff0000'>"._AM_WEBLINKS_WARNING_NOT_WRITABLE."</h3>\n";
	echo "$DIR_CONFIG <br /><br />\n";
}

xoops_cp_footer();
exit();

?>